import coverage
'''
python测试用例覆盖率工具coverage教程
https://cloud.tencent.com/developer/article/1646147
'''
def print_hi(name):
    if "cnblogs" in name:
        print(f'Hi, 博客园')
    elif "test-gang" in name:
        print(f'Hi, 小罡测试笔记')
    else:
        print(f'Hi, python')

if __name__ == '__main__':
    cov = coverage.Coverage()  # 创建Coverage对象
    cov.start()  # 开始测量
    print_hi('test-gang')  # 需要测量的代码块
    cov.stop()  # 结束测量
    cov.save()  # 保存结果
    cov.report()  # 生成控制台报告
    cov.html_report()  # 生成HTML报告
